use yew::prelude::*;
use serde::{Deserialize, Serialize};
use reqwest::Client;

#[derive(Serialize, Deserialize)]
struct RegisterRequest {
    username: String,
    email: String,
    password: String,
}

#[derive(Serialize, Deserialize)]
struct RegisterResponse {
    id: i32,
    username: String,
    email: String,
}

#[derive(Serialize, Deserialize)]
struct LoginForm {
    token: String,
}

pub struct RegisterForm {
    usename: String,
    email: String,
    password: String,
    link: ComponentLink<Self>,
}

pub struct LoginForm {
    username: String,
    password: String,
    link: ComponentLink<Self>,
    error: Option<String>,
}

pub enum Msg {
    SetUsername(String),
    SetEmail(String),
    SetPassword(String),
    Register,
    Login,
    LoginSuccess(LoginResponse),
    LoginError(String),
}


// TODO
impl Component for RegisterForm {
    type Message = Msg;
    type Properties = ();

    fn create(){
        Self{

        }
    }

    fn update(){
        match msg {

        }
    }

    fn view(&self) -> Html{
        html!{

        }
    }

}
fn app() -> Html {
    html!{

    }
}

fn main(){
    yew::start_app::<App>();
}


